<?php

namespace App\Http\Requests\OpenWechat;

use App\Http\Requests\ApiRequest;
use Illuminate\Http\UploadedFile;

/**
 * @property string appid
 * @property UploadedFile video
 * @property string code_type
 */
class VideoShareStoreRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $mb_kbs = 1024;
        $limit_size = 10 * $mb_kbs;
        //|mimes:mp4
        return [
            'video'     => 'required|file|max:' . $limit_size,
            'code_type' => 'sometimes|in:png,text',
            'appid'     => 'required|string',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'video.required' => '视频文件必须上传',
//            'video.file' => '必须上传文件',
//            'video.max' => '视频文件不能大于10mb',
//        ];
//    }
}
